package edu.zut.hb.ambition.inoutpatienttype.domain;


import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Inoutpatienttype;
import com.ruoyi.system.service.IInoutpatienttypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;


@RestController
@RequestMapping("/system/inoutpatienttype")
public class InoutpatienttypeGroup extends BaseController
{
    @Autowired
    private IInoutpatienttypeService inoutpatienttypeService;

    /**
     * 查询住院收费列表
     */
    @PreAuthorize("@ss.hasPermi('system:inoutpatienttype:list')")
    @GetMapping("/list")
    public TableDataInfo list(Inoutpatienttype inoutpatienttype)
    {
        startPage();
        List<Inoutpatienttype> list = inoutpatienttypeService.selectInoutpatienttypeList(inoutpatienttype);
        return getDataTable(list);
    }

    /**
     * 导出住院收费列表
     */
    @PreAuthorize("@ss.hasPermi('system:inoutpatienttype:export')")
    @Log(title = "住院收费", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Inoutpatienttype inoutpatienttype)
    {
        List<Inoutpatienttype> list = inoutpatienttypeService.selectInoutpatienttypeList(inoutpatienttype);
        ExcelUtil<Inoutpatienttype> util = new ExcelUtil<Inoutpatienttype>(Inoutpatienttype.class);
        util.exportExcel(response, list, "住院收费数据");
    }

    /**
     * 获取住院收费详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:inoutpatienttype:query')")
    @GetMapping(value = "/{inoutpatientid}")
    public AjaxResult getInfo(@PathVariable("inoutpatientid") Long inoutpatientid)
    {
        return AjaxResult.success(inoutpatienttypeService.selectInoutpatienttypeByInoutpatientid(inoutpatientid));
    }

    /**
     * 新增住院收费
     */
    @PreAuthorize("@ss.hasPermi('system:inoutpatienttype:add')")
    @Log(title = "住院收费", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Inoutpatienttype inoutpatienttype)
    {
        return toAjax(inoutpatienttypeService.insertInoutpatienttype(inoutpatienttype));
    }

    /**
     * 修改住院收费
     */
    @PreAuthorize("@ss.hasPermi('system:inoutpatienttype:edit')")
    @Log(title = "住院收费", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Inoutpatienttype inoutpatienttype)
    {
        return toAjax(inoutpatienttypeService.updateInoutpatienttype(inoutpatienttype));
    }

    /**
     * 删除住院收费
     */
    @PreAuthorize("@ss.hasPermi('system:inoutpatienttype:remove')")
    @Log(title = "住院收费", businessType = BusinessType.DELETE)
    @DeleteMapping("/{inoutpatientids}")
    public AjaxResult remove(@PathVariable Long[] inoutpatientids)
    {
        return toAjax(inoutpatienttypeService.deleteInoutpatienttypeByInoutpatientids(inoutpatientids));
    }
}


